# 字典类型
# 字典的创建方式除了常规的方式也可以通过映射函数创建
list1 = [1, 2, 3, 4, 5]
list2 = ["age1", "age2", "age3", "age4"]
list3 = ["age1", "age2", "age3", "age4", "age5", "age6"]
list4 = ["age1", "age2", "age3", "age4", "age5"]
zipobj1 = zip(list1, list2)
zipobj2 = zip(list1, list3)

# <zip object at 0x000001D486E3F900>
print(zipobj1)
# <zip object at 0x000001D486E3F800>
print(zipobj2)

dict1 = dict(zipobj1)
dict2 = dict(zipobj2)
# {1: 'age1', 2: 'age2', 3: 'age3', 4: 'age4'}
print(dict1)
# {1: 'age1', 2: 'age2', 3: 'age3', 4: 'age4', 5: 'age5'}
print(dict2)

# 字典的生成式
# 当list1 与 list4的列表数量不对应时则会输出{}
dict3 = {key:value for key, value in zip(list1, list4)}
print(dict3)


